Make GPX not crash when we have -s and *only* a shortname already.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 27 Aug 2003 18:05:41 +0000 (18:05 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 27 Aug 2003 18:05:41 +0000 (18:05 +0000)
gpsbabel/Makefile
gpsbabel/gpx.c

index 15f435227739e69101baf69cf37ba593f36569a1..f77200616975a5346f696856bb09a6b6cad3e944 100644 (file)
@@ -69,8 +69,8 @@ dep:
        (echo -n "internal_styles.c: mkstyle.sh " ; echo style/*.style ; /bin/echo -e "\t./mkstyle.sh > $@ || (rm -f $@ ; exit 1)" ) >> /tmp/dep
        echo Edit Makefile and bring in /tmp/dep
 
-VERSIONU=1_1_1_beta08122003
-VERSIOND=1.1.1_beta08122003
+VERSIONU=1_1_1_beta08262003
+VERSIOND=1.1.1_beta08262003
 release:
        rm -fr gpsbabel-$(VERSIOND)
        cvs tag gpsbabel_$(VERSIONU)
index 5ed82708e36724293e2df329442d5db03364d443..f9d82ba277a54d5a6039a1435e307465bb03cea5 100644 (file)
@@ -941,8 +941,22 @@ static void
 gpx_waypt_pr(const waypoint *waypointp)
 {
        char *tmp_ent;
-       const char *oname = global_opts.synthesize_shortnames ?
-                                 mkshort(mkshort_handle, waypointp->notes) : 
+       const char *oname;
+       char *odesc;
+
+       /*
+        * Desparation time, try very hard to get a good shortname
+        */
+       odesc = waypointp->notes;
+       if (!odesc) {
+               odesc = waypointp->description;
+       }
+       if (!odesc) {
+               odesc = waypointp->shortname;
+       }
+
+       oname = global_opts.synthesize_shortnames ?
+                                 mkshort(mkshort_handle, odesc) : 
                                  waypointp->shortname;
 
        fprintf(ofd, "<wpt lat=\"%lf\" lon=\"%lf\">\n",